package com.gml.design.principle.lishitihuan.optimize;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;

public class CashCard extends BankCard{
    private Logger logger = LoggerFactory.getLogger(CashCard.class);

    public CashCard(String cardNo, String cardDate){
        super(cardNo, cardDate);
    }

    @Override
    boolean rule(BigDecimal amount) {
        return false;
    }

    /**
     * 提现
     * @param orderId
     * @param amount
     * @return
     */
    public String withDrawal(String orderId, BigDecimal amount){
        //模拟支付
        logger.info("体现成功， 单号：{} 金额：{}", orderId, amount);
        return super.negative(orderId, amount);
    }

    public String recharge(String orderId, BigDecimal amount){
        //模拟存钱
        logger.info("储值成功， 单号：{} 金额：{}", orderId, amount);
        return super.positive(orderId, amount);
    }

    /**
     * 风险校验
     * @param cardNo
     * @param orderId
     * @param amount
     * @return
     */
    public boolean checkRisk(String cardNo, String orderId, BigDecimal amount){
        //模拟风控校验
        logger.info("风险校验， 卡号：{} 单号：{} 金额：{}", cardNo, orderId, amount);
        return true;
    }
}
